package com.ymx.darling.wrapper.fragment;

import com.ymx.darling.util.StringLink;
import com.ymx.darling.bean.sql.SqlStatement;

import java.util.ArrayList;

public class GroupBySegment implements SqlSegment {
    private final StringLink groupBy = new StringLink();

    @Override
    public SqlStatement getSqlStatement() {
        return new SqlStatement(groupBy.toString(), new ArrayList<>());
    }

    public void splitGroupBy(String[] columns){
        for(String val : columns){
            groupBy.append(val).append(",");
        }
        //删除最后一个逗号
        groupBy.deleteLast();
    }
}
